function Hq(pageid) {
    // console.log(pageid);
    fetch("http://chst.vip:1234/api/getmoneyctrl?pageid=" + pageid)
        .then(body => body.json())
        .then(res => {
            // console.log(res)
            let html = "";
            res.result.forEach(item => {
                html += `<li>
            <a href="../page/indexXiang.html?productid=${item.productId}">
                <div class="left">${item.productImg2}</div>
                <div class="right"><div class="top">${item.productName}</div><div><span>${item.productFrom}|${item.productTime}</span><span>${item.productComCount}</span></div></div>
            </a>
           </li>`
                let productA = document.querySelector("#product .info")
                productA.innerHTML = html
            })
        
        })
}
Hq(0)

function a(){
    fetch("http://chst.vip:1234/api/getmoneyctrl" )
.then(body => body.json())
.then(res => {
    let pageid = 0;
    let totalCount = res.totalCount
    let yemian = document.querySelector("#buttom .xz") 
            let yemian1 = "";
            for (let a = 0; a <= totalCount / 10 ; a++) {
                yemian1 += `<option value="${a}">${a + 1}/${Math.floor(totalCount / 10)+1}</option>`
            }
            yemian.innerHTML = yemian1

            let up = document.querySelector("#buttom .up")
            let next = document.querySelector("#buttom .next")


            up.onclick = function () {
                if (pageid >= 1) {
                    pageid -= 1;
                    // console.log(pageid);
                    let yemian = document.querySelector("#buttom .xz")
                    yemian.options[pageid].selected=true;
                    Hq(pageid)
                }
            }


            next.onclick = function () {
                if (pageid <= totalCount / 10 - 1) {
                    pageid += 1;
                    // console.log(pageid);
                    let yemian = document.querySelector("#buttom .xz")
                    yemian.options[pageid].selected=true;
                    Hq(pageid)
                }
            }

            
            $('.xz').change(function () {
                // console.log(this.value);
                let b = this.value
                // $('.xz').value=newvalue;
                pageid = b-0;
                // console.log(pageid);
                Hq(pageid)
            }) 
})
}
a()




